/*
 * Copyright (C) 2017 Pingan, Inc. All Rights Reserved.
 */

package com.pingan.haofang.searchcloud.web.index.vo;

import com.pingan.haofang.searchcloud.common.constants.Constants;
import com.pingan.haofang.searchcloud.common.validator.annotation.EnumOption;
import com.pingan.haofang.searchcloud.index.constants.IndexDatasourceStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 增量回调RPC导入任务视图
 *
 * @author zhangbi617
 * @date 03/05/2017
 */
@ApiModel(description = "增量回调RPC导入任务视图")
public class IncCallbackRpcIndexDataSourceVO {

    @ApiModelProperty(value = "rpc的URL")
    @NotBlank
    @URL
    @Length(max = 512)
    private String rpcUrl;

    @ApiModelProperty(value = "rpc对应方法名")
    @NotBlank
    @Length(max = 45)
    @Pattern(regexp = Constants.METHOD_PATTERN, message = "common.method.pattern.error")
    private String rpcMethod;

    @ApiModelProperty(value = "分页大小")
    @NotNull
    @Range(min = 1, max = 5000, message = "分页最大不能超过5000")
    private Integer pageSize;

    @ApiModelProperty(value = "缓冲区状态 0：正常 1：停用")
    @EnumOption(enumClass = IndexDatasourceStatus.class)
    private Integer bufferStatus ;

    @ApiModelProperty(value = "缓冲区最大容量")
    @Range(min = 1, max = 5000, message = "indexDatasource.incDatasourceRpc.buffer.size.illegal")
    private Integer bufferSize ;

    @ApiModelProperty(value = "最大等待時間,秒")
    @Range(min = 1, max = 10 * 60, message = "indexDatasource.incDatasourceRpc.buffer.maxWaitTime.illegal")
    private Integer maxWaitTime ;

    public String getRpcUrl() {
        return rpcUrl;
    }

    public void setRpcUrl(String rpcUrl) {
        this.rpcUrl = rpcUrl;
    }

    public String getRpcMethod() {
        return rpcMethod;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public void setRpcMethod(String rpcMethod) {
        this.rpcMethod = rpcMethod;
    }

    public Integer getBufferStatus() {
        return bufferStatus;
    }

    public void setBufferStatus(Integer bufferStatus) {
        this.bufferStatus = bufferStatus;
    }

    public Integer getBufferSize() {
        return bufferSize;
    }

    public void setBufferSize(Integer bufferSize) {
        this.bufferSize = bufferSize;
    }

    public Integer getMaxWaitTime() {
        return maxWaitTime;
    }

    public void setMaxWaitTime(Integer maxWaitTime) {
        this.maxWaitTime = maxWaitTime;
    }

    @Override
    public String toString() {
        return "IncCallbackRpcIndexDataSourceVO{" +
                "rpcUrl='" + rpcUrl + '\'' +
                ", rpcMethod='" + rpcMethod + '\'' +
                ", pageSize=" + pageSize +
                ", bufferStatus=" + bufferStatus +
                ", bufferSize=" + bufferSize +
                ", maxWaitTime=" + maxWaitTime +
                '}';
    }
}
